function fillZeroWith(index) {
    if (index <= 0) return;

    if (String(index).length === 1) {
        return `00${index}`
    }

    if (String(index).length === 2) {
        return `0${index}`
    }

    if (String(index).length === 3) {
        return `${index}`
    }
}


function getNumDigit(number) {
    let digit = 0;
    while (number >= 1) {
        number = number / 10;
        digit++;
    }
    return digit;
}



// 不考虑超过100的数字
function number2Hanz(number) {
    if (number > 100) {
        throw new Error('不允许超过100的数字')
    }

    const numberMap = new Map([
        ['@default', ''],
        [0, ''],
        [1, '一'],
        [2, '二'],
        [3, '三'],
        [4, '四'],
        [5, '五'],
        [6, '六'],
        [7, '七'],
        [8, '八'],
        [9, '九'],
    ])

    const ge = parseInt(number % 10)
    const shi = parseInt((number % 100) / 10)
    const bai = parseInt((number % 1000) / 100)

    let ge_hanz = numberMap.get(ge)
    let shi_hanz = numberMap.get(shi)
    let bai_hanz = numberMap.get(bai)

    // add digit_hanz
    shi_hanz && (shi_hanz += '十')
    bai_hanz && (bai_hanz += '百')

    return `${bai_hanz}${shi_hanz}${ge_hanz}`
}

export { fillZeroWith, getNumDigit, number2Hanz }